package com.school.controller;

import com.school.entity.Archives;
import com.school.service.ArchivesService;
import com.school.untils.ResultEntity;
import com.school.untils.ResultUtils;
import io.swagger.annotations.Api;
import io.swagger.annotations.ApiOperation;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.*;

@Api(tags = "档案信息管理")
@RestController
@RequestMapping("/archives")
public class ArchivesController {
    @Autowired
    ArchivesService archivesService;

    // 增加
    @ApiOperation("档案信息增加")
    @RequestMapping(value = "/add",method = RequestMethod.POST)
    public ResultEntity addArchives(@RequestBody Archives archives){
        return  ResultUtils.build(archivesService.addArchives(archives));
    }

    // 根据id查看详情
    @ApiOperation("档案信息查看详情")
    @GetMapping("/getDetailsById/{id}")
    public ResultEntity getDetailsById(@PathVariable("id") String id){
        return ResultUtils.build(archivesService.getDetailsById(id));
    }

    // 根据条件分页查询
    @ApiOperation("根据条件分页查询")
    @GetMapping("/specificPage")
    public ResultEntity specificPageQueryArchivesList(Archives archives, @RequestParam int page, @RequestParam int size){
        return ResultUtils.build(archivesService.specificPageQueryArchivesList(archives,page,size));
    }

}
